<?php foreach($data as $value){

            $a_Event = explode(',',$value['Apply']['available']);
            $a_Temps = array();
            if($a_Event)
            {
                foreach($a_Event as $event)
                {
                    $a_Temps[] = strtotime($event);
                }
            }
            sort($a_Temps);
            $i_currentMonth = date('n');
           // $a_EventMonth = explode('-',date('m'));
            $i_eventMonth = date('m',$a_Temps[0]);
            $jump = $i_eventMonth - $i_currentMonth;
?>


<!--RESULT WRAP-->
<div class="result_wrap" style="border-bottom: none; clear: both; margin: 0 0 20px 0;">

<!--COLUMN 1-->
<div class="FourColGrid_c1">
<div id="myAvatar">
<?php 
                if($value['Vacancy']['Avatar'])
                {
                    echo '<img src="'. Router::url('/').'app/webroot/img/avatar/'.$value['Vacancy']['Avatar'].'" width="100" alt="Pharmacy Shop picture">';
                }else
                {
                    echo '<img src="'.Router::url('/').'app/webroot/img/avatar.jpg" width="100" alt="Pharmacy Shop picture">';
                }
?>
</div>

<?php if($value['Apply']['status'] == 1){?>
<?php  echo $html->link(__('Accept', true), array('controller'=>'pharmacies','action' => 'accepted/'.$value['Apply']['id']),array('class'=>'TitleFive'));?>
<?php echo $html->link(__('Decline', true), array('controller'=>'pharmacies','action' => 'decline/'.$value['Apply']['id']),array('class'=>'TitleFive'));?>
<?php }?>
<?php if($value['Apply']['status'] == 2 && $value['Apply']['rate'] !=1){
                echo $html->link(__('Rate', true), array('controller'=>'pharmacies','action' => 'rate/'.$value['Apply']['id']),array('class'=>'TitleFive'));
}?>
</div>
<!--COLUMN 1-->

<!--COLUMN 2-->
<div class="FourColGrid_c2" style="width: 290px;">
<h1 class="TitleOne">
<?php if($value['Apply']['status'] == 2){echo '<span style="color: #F00;">Accepted</span>';}?><?php if($value['Apply']['status'] == 3){echo '<span style="color: #F00;">Declined</span>';}?> <?php echo $value['User']['Username']?></h1>

<h2 class="TitleTwo"><?php echo $GLOBALS['Country'][$value['User']['Country_id']]?></h2>
<p><b>Rate of pay</b> - <?php echo '£'.$value['Apply']['HourlyRate']?> per hour<br>
</div>
<!--COLUMN 2-->

<!--COLUMN 3-->
<div class="FourColGrid_c3" style="min-height: 160px;">
<div id="eventCalendarNoCache_<?php echo $value['Apply']['id']?>"></div>
<script>
$(document).ready(function() {
	$("#eventCalendarNoCache_"+<?php echo $value['Apply']['id']?>).eventCalendar({
	eventsjson: '<?php echo Router::url('/').'pharmacies/getJsonApply/'.$value['Apply']['id'] ?>',
	cacheJson: false,
	multiple: true,
	allowClick:false,
	bothColor:true,
	jumpMonth:'<?php echo $jump;?>'
});
});
</script>
<h4 class="TitleTwo">Application Dates</h4>
<p>Calendar key</p>
<ul class="listTwo">
<li class="unavailable"> = Vacancy available</li>
<li class="applicationdates"> = Locum application dates</li>
</ul>
</div>
<!--COLUMN 3-->
<?php }?>
<br class="clear"/>
</div>
<!--RESULT WRAP-->

<br class="clear"/>
<div class="paginate">
Showing Page <?php echo $paginator->counter(); ?> &nbsp;&nbsp;&nbsp;
<?php echo $paginator->prev(); ?>
<?php echo $paginator->numbers(); ?>
<?php echo $paginator->next(); ?> 
</div>